/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package XMLManager;

import Database.XMLManager.XMLAddressFiles;
import exceptions.DatabaseException;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Marcello Maggioni
 */
public class XMLAddresses {

    private XMLAddressFiles xaf;
    
    public XMLAddresses() {
        xaf = (XMLAddressFiles) XMLAddressFiles.getDefaultInstance("D:\\tests");
    }

    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    // @Test
    // public void hello() {}

    @Test
    public void addressTests() {
        try {
            String[] addresses = {"addr1@email.tk", "addr2@email.tk", "addr3@email.tk"};
            xaf.setAddresses(addresses, "user1", null);
            String[] addresses2 = xaf.getAddresses("user1");
            assertTrue(Arrays.equals(addresses2, addresses));
        } catch (DatabaseException ex) {
            fail();
        }
    }
    
}